#include<iostream>
#include<string>
#include<cstring>
using namespace std;
const int MAXN= 105;
char map[MAXN][MAXN];
bool vis[MAXN][MAXN];
int ans=0,n;

void dfs(int x,int y){
	ans++;
	vis[x][y]=true;
	if(vis[x-1][y]==false && x-1>=1 && x-1<=n && y>=1 && y<=n && (map[x-1][y] == '.' || map[x-1][y] == 'B')){
		vis[x-1][y] = true;//左 
		dfs(x-1,y);
	}
	if(vis[x+1][y]==false && x+1>=1 && x+1<=n && y>=1 && y<=n && (map[x+1][y] == '.' || map[x+1][y] == 'B')){
		vis[x+1][y] = true;//右 
		dfs(x+1,y);
	}
	if(vis[x][y-1]==false && x>=1 && x<=n && y-1>=1 && y-1<=n && (map[x][y-1] == '.' || map[x][y-1] == 'B')){
		vis[x][y-1] = true;//上 
		dfs(x,y-1);
	}
	if(vis[x][y+1]==false && x>=1 && x<=n && y+1>=1 && y+1<=n && (map[x][y+1] == '.' || map[x][y+1] == 'B')){
		vis[x][y+1] = true;//下 
		dfs(x,y+1);
	}	
}

int main(){
	memset(vis,0,sizeof vis);
	cin>>n;
	
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			cin>>map[i][j];
			vis[i][j]==false;
			if(map[i][j] == 'W')	vis[i][j]==true;
		}
	}
	
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(map[i][j] == 'B' && vis[i][j] == false){
				dfs(i,j);
			}
		}
	}
	cout<<ans<<" "<<n*n-ans<<endl;
	return 0;
}
